/**
 * @file app.js
 * @author  fanxl
 */
const legoCore = require("../../output/index.cjs");
const spec = require("./spec.json");
const data = require("./data.json");
const {
    useForm,
    useRegistField,
    util: { getInitValue },
} = legoCore;

module.exports = () => {
    const form = useForm({ initialValues: getInitValue(spec, data) });
    useRegistField(spec, form);

    form.validateForm().then((errs) => {
        // eslint-disable-next-line no-console
        console.log("-----form values-----", JSON.stringify(form.values));
        // eslint-disable-next-line no-console
        console.log("-----form errors-----", JSON.stringify(form.errors));
    });
};
